﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Collections.Generic;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using TarreOA.TarreOABLL;
using TarreOA.TarreOAModels;

public partial class PublicCommunication_CommunicationLeft : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            this.DataList_DataTable();
            //this.hlkMyGroup.Attributes.Add("onclick", "hidTable('myGroup')");
            //this.hlkFoundUser.Attributes.Add("onclick", "hidTable('myFound')");
        }
    }

    protected void DataList_DataTable()
    {
        PublicCommunicationGroupService pcgService = new PublicCommunicationGroupService();
        DataTable dt = new DataTable();
        dt.Columns.Add("pcgId", typeof(string));
        dt.Columns.Add("pcgName", typeof(string));
        List<PublicCommunicationGrouptb> list = pcgService.findALL();
        if (list != null && list.Count > 0)
        {
            foreach (PublicCommunicationGrouptb pcg in list)
            {
                DataRow dr = dt.NewRow();
                dr["pcgId"] = pcg.PcgId.ToString();
                dr["pcgName"] = pcg.PcgName;
                dt.Rows.Add(dr);
            }
        }
        if (dt.Rows.Count > 0)
        {
            this.DataList1.DataSource = dt.DefaultView;
        }
        else
        {
            this.DataList1.DataSource = null;
        }
        this.DataList1.DataBind();
    }
    protected void DataList1_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
        {
            string pcg_id = ((HyperLink)e.Item.FindControl("hlkComGroup")).Attributes["pcg_Id"];
            ((HyperLink)e.Item.FindControl("hlkComGroup")).NavigateUrl = "CommunicationGroupLinkManShow.aspx?pcg_id=" + pcg_id;
        }
    }
}
